<html>
  <head>
    <title>history使用</title>
  </head>
  <body>
    <button onclick="push('/test1')">push test1</button> <br /><br />
    <button onclick="push('/test2')">push test2</button> <br /><br />
    <button onclick="replace('/test3')">replace test3</button> <br /><br />
    <button onclick="back()">回退</button>
    <button onclick="forward('/test3')">前进</button>
    <script src="https://unpkg.com/history/umd/history.production.min.js"></script>
    <script type="text/javascript">
      const history = HistoryLibrary.createBrowserHistory();
      // const history = HistoryLibrary.createHashHistory();
      // const history = HistoryLibrary.createMemoryHistory();

      function push(path) {
        history.push(path);
      }

      function replace(path) {
        history.replace(path);
      }

      function back() {
        history.back();
      }

      function forward() {
        history.forward();
      }

      history.listen(function(params) {
        console.log('监听到path更新', params);
      })
    </script>
  </body>
</html>
